<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //构造函数继承（call&apply）
        //说明：直接利用call或者apply方法将父类构造函数的this绑定为子类构造函数的this就可以；
        //缺点：无法继承原型链上的属性与方法；
        function Parent1() {
            this.name = 'parent1'
        }
        Parent1.prototype.say = function () {
            console.log(this.name)
        }
        function Child1() {
            Parent1.call(this)  //构造函数继承核心代码
            this.type = 'child1'
        }
        let child1_1 = new Child1()

        console.log(child1_1.name) // parent1
        console.log(child1_1.say()) // child1_1.say is not a function

    </script>
</body>

</html>